package cyc2018;

import java.util.Random;

public class 洗牌算法 {

    public void washCard(int[] card) {
        Random random = new Random();
        for (int i = card.length - 1; i >= 0; i--) {
            int cardIndex = random.nextInt(i + 1);// 得到[0, i]里面的数据
            card[cardIndex] ^= card[i];
            card[i] ^= card[cardIndex];
            card[cardIndex] ^= card[i];
        }
    }

    public static void main(String[] args) {
        Random random = new Random();
        for (int i = 0; i < 54; i++) {
            System.out.println(random.nextInt(54));
        }
    }
}
